<?php
/**
 * Api路由
 */

use think\facade\Route;

Route::group('app', function () {
    Route::rule('Site/getSiteView', 'app/Site/getSiteView', 'GET');
    Route::rule('Site/getTenantConfig', 'app/Site/getTenantConfig', 'GET');
    Route::rule('Wx/getGzhAppid', 'app/Wx/getGzhAppid', 'GET');
    Route::rule('Wx/wxLogin', 'app/Wx/wxLogin', 'GET');
    Route::rule('Wx/getSignature', 'app/Wx/getSignature', 'POST');
    Route::group('goods', function () {
        Route::rule('getDetail', 'app/Goods/getDetail', 'GET')->middleware(['AppViews', 'AppTokenUnHard']);
        Route::rule('getSampleDetail', 'app/Goods/getSampleDetail', 'GET')->middleware('AppToken');
        Route::rule('getList', 'app/Goods/getList', 'GET');
    });
    //    获取专题
    Route::group('Subject', function () {
        Route::rule('getList', 'app/Subject/getList', 'GET');
    });
    Route::group('User', function () {
        Route::rule('getUserInfo', 'app/User/getUserInfo', 'GET');
    })->middleware('AppToken');
    Route::group('Order', function () {
        Route::rule('create', 'app/Order/create', 'POST');
        Route::rule('getOrderDetail', 'app/Order/getOrderDetail', 'GET');
        Route::rule('getOrderList', 'app/Order/getOrderList', 'GET');
        Route::rule('getOrderUseCode', 'app/Order/getOrderUseCode', 'GET');
        Route::rule('getRefundData', 'app/Order/getRefundData', 'GET');
        Route::rule('refund', 'app/Order/refund', 'GET');
    })->middleware('AppToken');
    Route::group('Pay', function () {
        Route::rule('wxPay', 'app/Pay/wxPay', 'GET');
        Route::rule('getPayReuslt', 'app/Pay/getPayReuslt', 'GET');
    })->middleware('AppToken');
    Route::group('Distribution', function () {
        Route::rule('getMyDistribution', 'app/Distribution/getMyDistribution', 'GET');
    })->middleware('AppToken');
    Route::group('Reward', function () {
        Route::rule('getMyReward', 'app/Reward/getMyReward', 'GET');
        Route::rule('getRank', 'app/Reward/getRank', 'GET');
    })->middleware('AppToken');
    Route::group('Wallet', function () {
        Route::rule('getIncome', 'app/Wallet/getIncome', 'GET');
    })->middleware('AppToken');
    Route::group('Withdrawals', function () {
        Route::rule('getWithdrawals', 'app/Withdrawals/getWithdrawals', 'GET');
        Route::rule('apply', 'app/Withdrawals/apply', 'GET');
        Route::rule('geRecord', 'app/Withdrawals/geRecord', 'GET');
    })->middleware('AppToken');
    Route::group('Upload', function () {
        Route::rule('uploadImg', 'app/Upload/uploadImg', 'POST');
        Route::rule('delImg', 'app/Upload/delImg', 'GET');
    })->middleware('AppToken');
    Route::group('Comment', function () {
        Route::rule('pub', 'app/Comment/pub', 'POST');
        Route::rule('getList', 'app/Comment/getList', 'GET');
    })->middleware('AppToken');
    Route::group('KanJia', function () {
        Route::rule('createOrder', 'app/KanJia/createOrder', 'GET');
        Route::rule('kanJia', 'app/KanJia/kanJia', 'GET');
        Route::rule('get', 'app/KanJia/get', 'GET');
        Route::rule('getOrderList', 'app/KanJia/getOrderList', 'GET');
        Route::rule('close', 'app/KanJia/close', 'GET');
        Route::rule('getHelp', 'app/KanJia/getHelp', 'GET');
    })->middleware('AppToken');
    Route::group('Vip', function () {
        Route::rule('get', 'app/Vip/get', 'GET');
    })->middleware('AppToken');
    Route::group('Category', function () {
        Route::rule('getList', 'app/Category/getList', 'GET');
    });
    Route::group('Complain', function () {
        Route::rule('save', 'app/Complain/save', 'POST');
    })->middleware('AppToken');
    Route::group('Suggest', function () {
        Route::rule('save', 'app/Suggest/save', 'POST');
    })->middleware('AppToken');
//   商家操作接口
    Route::group('StoreAdmin', function () {
        Route::group('Order', function () {
            Route::rule('getOrderByCode', 'app/StoreAdminOrder/getOrderByCode', 'GET')
                ->middleware(['AppGetStoreByCode', 'AppCheckStoreUser']);
            Route::rule('checkCode', 'app/StoreAdminOrder/checkCode', 'GET')
                ->middleware(['AppGetStoreByCode', 'AppCheckStoreUser']);
        });
    })->middleware('AppToken');
    //MISS路由定义
    Route::miss('app/Miss/index');
})->middleware('AppTenantCheck');
